package com.ww.springboot.boot.util.pdf;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.springframework.core.io.ClassPathResource;

import java.io.IOException;

/**
 * 描述：
 *
 * @author 🧑 ‍wanwei
 * @since 2022-03-24 15:23
 */
public class Base64ToPdf {


    public static void main(String[] args) throws IOException {
        ClassPathResource classPathResource = new ClassPathResource("/static/text/pdf.txt");
        String text = IOUtils.toString(classPathResource.getInputStream(), "utf-8");
        byte[] bytes = Base64.decodeBase64(text);
        FileUtil.writeBytes(bytes, "C:\\Users\\ZH500\\桌面\\test\\" + System.currentTimeMillis() + ".png");
    }
}
